import Vue from 'vue';
import VueRouter from 'vue-router';

var Index = r => require.ensure([], () => r(require('./home/index.vue')), 'index');

Vue.use(VueRouter);
const router = new VueRouter({
	mode: 'hash', //hash 打包需要使用hash 无#： history
	routes: [
		{ //前台路由配置
			path: '/',
			component: Index,
			meta: {
				title: '首页'
			}
		}
	]
})

router.beforeEach((to, from, next) => {
	if(to.meta.title) {
		document.title = to.meta.title + '-个人中心'
	}
	next();
});

router.afterEach(route => {

})
export default router